#include <bits/stdc++.h>
using namespace std;
int row, color;
void put(int i, int j, int offx = 0, int offy = 0) {
  cout << i + offx << ' ' << j + offy << endl;
}
void print_even(int n, int m, int offx = 0, int offy = 0) {
  int i = 1, j = 1;
  while (i < n) {
    while (j <= m) {
      put(i, j, offx, offy);
      i++, j++;
      if (j > m) break;
      put(i, j, offx, offy);
      i--;
    }
    j = 1;
    put(i, j, offx, offy);
    i++, j = m;
    if (i > n) break;
    while (j > 0) {
      put(i, j, offx, offy);
      i++, j--;
      if (j <= 0) break;
      put(i, j, offx, offy);
      i--;
    }
    // i++, j = m;
    j = m;
    put(i, j, offx, offy);
    // break;
  }
}
void print_odd(int n, int m) {
  int i = 1, j = 1;
  put(i, j);
  j += 2, i = 2;
  while (i <= n) {
    put(i, j);
    i = 1;
    put(i, j);
    j += 2, i = 2;
  }
  j = 1;
  put(i, j);
  i = 3, j = m - 1;
  while (j >= 1) {
    put(i, j);
    i = 2;
    put(i, j);
    i = 3, j -= 2;
  }
  i = 3, j = 1;
  while (j <= m) {
    if (j <= m) put(i, j);
    i = 1, j++;
    if (j <= m) put(i, j);
    i = 3, j++;
  }
  i = 3, j = m;
  print_even(n - 3, m, 3, 0);
}
int main() {
  cin >> row >> color;
  if (row % 2 == 0) {
    print_even(row, color);
  } else {
    print_odd(row, color);
  }
}
